home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
HYP
/
C-D
/
dbImporter.cpt
/
dbImporter
/
card_2840.txt
< prev
next >
Wrap
Text File
|
1989-02-26
|
7KB
|
266 lines
-- card: 2840 from stack: in
-- bmap block id: 0
-- flags: 0000
-- background id: 2586
-- name:
----- HyperTalk script -----
on openCard
hide message
end openCard
-- part 3 (button)
-- low flags: 00
-- high flags: 8006
-- rect: left=287 top=29 right=51 bottom=451
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Set Field Names
----- HyperTalk script -----
--prepare text data file with field headers (names) separated by tabs
--to use this button, prepare at least as many card background fields
--as fields separated by tabs of your text data file
-- by Ted Tripp, 4588 CR 523, Bayfield, CO 81122, 303-884-9029
on mouseUp
ask "Set field names from which file?"
if it is empty then exit mouseUp
put it into fileName
open file fileName
read from file fileName until return --get field headers
if it is empty then
close file fileName
exit mouseUp
end if
put it into fieldNames
repeat with i = 1 to the number of fields
put offset(tab,fieldNames) into num --gets characters until tab
if num is 0 then
set name of field i to fieldNames -- sets last field name, stops
put fieldNames into field i
exit repeat
end if
get char 1 to num - 1 of fieldNames
set name of field i to it
put it into field i
delete char 1 to num of fieldNames
end repeat
close file fileName
choose field tool --ready to adjust fields
end mouseUp
-- part 4 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=231 top=31 right=70 bottom=272
-- title width / last selected line: 0
-- icon id / first selected line: 19678 / 19678
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Tell Me About...
----- HyperTalk script -----
on mouseUp
go to card "About…"
end mouseUp
-- part 9 (button)
-- low flags: 00
-- high flags: 8006
-- rect: left=287 top=52 right=74 bottom=451
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Import database
----- HyperTalk script -----
--to use this button, prepare at least as many HC background fields
--as fields separated by tabs of your text data file
-- by Ted Tripp, 4588 CR 523, Bayfield, CO 81122, 303-884-9029
on mouseUp
ask "Import text from which file?"
if it is empty then exit mouseUp
put it into fileName
open file fileName
set cursor to 4
repeat
read from file fileName until return -- get first record
if it is empty then
doMenu "Delete Card"
close file fileName
exit mouseUp
end if
put it into data
repeat with i = 1 to the number of fields
put offset(tab,data) into num --gets first field (until tab)
if num is 0 then -- last field of record has no tab
put data into field i -- writes last field
delete last char of field i -- deletes return char
if first char of field i is quote and last char of field i is quote then --deletes quote marks
delete first char of field i
delete last char of field i
end if
exit repeat -- stops
end if
put char 1 to (num - 1) of data into field i -- writes first field
repeat while last char of field i is tab -- pesky ASCII 9!
delete last char of field i
end repeat
if first char of field i is quote and last char of field i is quote then --deletes quote marks
delete first char of field i
delete last char of field i
end if
delete char 1 to num of data -- gets rid of field
end repeat
doMenu "New Card"
end repeat
close file fileName
set cursor to 1
end mouseUp
-- part 11 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=350 top=301 right=323 bottom=431
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Field fixer
----- HyperTalk script -----
--because the import script encountering an empty field sometimes lets
--an invisible tab or return character slip into the hc field, or the
--user accidentally puts a return character into a text field,
--when the hc database is exported it is all screwed up! So, this script
--fixes up the hc database for export.
on mouseUp
set cursor to 4
put the name of this bkgnd into bakground
go to first card of bkgnd bakground
repeat for the number of cards
get the name of this bkgnd
if it is not bakground then exit repeat
repeat with i = 1 to the number of fields
get last char of field i
if it is tab then put empty into last char of field i
repeat while last char of field i is return
get last char of field i
if it is return then
put empty into last char of field i
end if
end repeat
repeat while offset(return,field i) is not 0
get offset(return,field i)
put space & "*" & space into char it of field i
end repeat
end repeat
go next card
end repeat
end mouseUp
-- part 12 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=60 top=301 right=323 bottom=184
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Export database
----- HyperTalk script -----
on mouseUp
put the short name of this stack & ".text" into fileName
ask "Export text to what file?" with fileName
if it is empty then exit mouseUp
put it into fileName
open file fileName
set cursor to 4
put the name of this bkgnd into bakground
go to first card of bkgnd bakground
repeat for the number of cards
get the name of this bkgnd
if it is not bakground then exit repeat
repeat with i = 1 to the number of fields
write field i & tab to file fileName
end repeat
write return to file fileName
go to next card
end repeat
close file fileName
set cursor to 1
end mouseUp
-- part contents for background part 1
----- text -----
database Importer
-- part contents for background part 25
----- text -----
Field 2
-- part contents for background part 26
----- text -----
Field 3
-- part contents for background part 27
----- text -----
Field 4
-- part contents for background part 28
----- text -----
Field 5
-- part contents for background part 29
----- text -----
Field 6
-- part contents for background part 30
----- text -----
Field 7
-- part contents for background part 31
----- text -----
Field 8
-- part contents for background part 32
----- text -----
Field 9
-- part contents for background part 33
----- text -----
Field Ten
-- part contents for background part 34
----- text -----
Field Eleven
-- part contents for background part 35
----- text -----
Field Twelve
-- part contents for background part 36
----- text -----
Field Thirteen